/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;

/**
 *
 * @author Tomas
 */
@Entity
@Table(name = "FOLDER_CHANGE_LOG")
public class FolderChangeLog implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    private Long id;
    
    @Column(name = "CHANGE_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date changeDate;
    
    @Column(name = "FOLDER_NAME")
    private String folderName;
    
    @Column(name = "FOLDER_ID")
    private Long folderId;
    
    @JoinColumn(name = "OPERATION_TYPE_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private OperationType operationType;
    
    @Column(name="USER_ID")
    private Long userId;

    public FolderChangeLog() {
    }

    public FolderChangeLog(Long id) {
        this.id = id;
    }

    public FolderChangeLog(Long id, Date date, String folderName) {
        this.id = id;
        this.changeDate = date;
        this.folderName = folderName;
    }

    public FolderChangeLog(Date date, String folderName, Long folderId, OperationType operationType, Long userId) {
        this.changeDate = date;
        this.folderName = folderName;
        this.folderId = folderId;
        this.operationType = operationType;
        this.userId = userId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDate() {
        return changeDate;
    }

    public void setDate(Date date) {
        this.changeDate = date;
    }

    public String getFolderName() {
        return folderName;
    }

    public void setFolderName(String folderName) {
        this.folderName = folderName;
    }

    public Long getFolderId() {
        return folderId;
    }

    public void setFolderId(Long folderId) {
        this.folderId = folderId;
    }

    public OperationType getOperationType() {
        return operationType;
    }

    public void setOperationType(OperationType operationType) {
        this.operationType = operationType;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FolderChangeLog)) {
            return false;
        }
        FolderChangeLog other = (FolderChangeLog) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FolderChangeLog[ id=" + id + " ]";
    }
    
}
